# -*- coding: utf-8 -*-
import os
import shutil


def get_target_name(src: str, source_path, target_path):
    return src.replace(source_path, target_path)


def mv_target(source, source_path, target_path):
    t = get_target_name(source, source_path, target_path)
    mv(source, t)


def mv(source, target):
    target_dir = os.path.dirname(target)
    if not os.path.exists(target_dir):
        os.makedirs(target_dir)
    shutil.move(source, target)
